home *** CD-ROM | disk | FTP | other *** search
/ Champak 54 / Vol 54.iso / games / turttleo.swf / scripts / DefineSprite_63_Slider / frame_1 / DoAction.as
Encoding:
Text File  |  2007-10-01  |  1.3 KB  |  64 lines

  1. function HideHandle()
  2. {
  3.    mcHandle._visible = false;
  4. }
  5. function SetValue(val, initializing)
  6. {
  7.    this.Value = Math.floor(Math.max(0,Math.min(100,val)));
  8.    Tracer.trace("set val=" + val);
  9.    Update();
  10.    if(initializing == false || initializing == undefined)
  11.    {
  12.       if(OnValueChanged != undefined)
  13.       {
  14.          OnValueChanged();
  15.       }
  16.    }
  17. }
  18. function Update()
  19. {
  20.    var _loc1_ = (- mcMask._width) * (100 - Value) / 100;
  21.    var _loc3_ = mcMask._width * Value / 100;
  22.    mcMask._x = _loc1_;
  23.    mcHandle._x = _loc3_;
  24.    var _loc2_ = mcAllocator._visible;
  25.    mcAllocator._visible = false;
  26.    mcAllocator._visible = true;
  27.    mcAllocator._visible = _loc2_;
  28. }
  29. var Value;
  30. var ReadOnly;
  31. var ShowHandle;
  32. var OnValueChanged;
  33. if(ReadOnly == undefined)
  34. {
  35.    ReadOnly = false;
  36. }
  37. if(ShowHandle == undefined)
  38. {
  39.    ShowHandle = true;
  40. }
  41. mcAllocator._visible = false;
  42. mcHandle._visible = ShowHandle;
  43. SetValue(Value,true);
  44. if(!ReadOnly)
  45. {
  46.    this.hitArea = this;
  47.    this.onPress = function()
  48.    {
  49.       if(!ReadOnly)
  50.       {
  51.          SetValue(100 - (mcHit._width - this._xmouse) * 100 / mcHit._width);
  52.       }
  53.    };
  54.    this.onRollOver = function()
  55.    {
  56.       mcAllocator._visible = true;
  57.    };
  58.    this.onRollOut = function()
  59.    {
  60.       mcAllocator._visible = false;
  61.    };
  62. }
  63. mcHit._visible = false;
  64.